"use strict";

function createCounter(initial) {
    var counter = initial;

    function increment(value) {
        counter += value;
        function test(){
            console.log(value);
        }
        console.log(counter);
        return test()
    }

    function get() {
        console.log(1);
        // return counter;
    }

    return {
        increment: increment,
        get: get
    };
}


// [
//     0:incremetscope,
//     1:Closure,
//     2:global
// ]
var myCounter = createCounter(100);

console.log(myCounter.get());   // 返回 100
myCounter.increment(5);
console.log(myCounter.get());   // 返回 105

myCounter = null;